package com.test.map.Users;

import org.json.JSONException;
import org.json.JSONObject;

public class Order {
    private String id;//司机姓名
    private String car_id;//车牌号
    private String passenger;//乘客姓名
    private String type;//拼车？
    private String finished;//是否被成功抢单
    private String end_place;//目的地
    private String start_place;//起始地
    private String cost;//费用
    private String car_type;

    public String getCar_type() {
        return car_type;
    }

    public void setCar_type(String car_type) {
        this.car_type = car_type;
    }


    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getCar_id() {
        return car_id;
    }

    public void setCar_id(String car_id) {
        this.car_id = car_id;
    }

    public String getPassenger() {
        return passenger;
    }

    public void setPassenger(String passenger) {
        this.passenger = passenger;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getFinished() {
        return finished;
    }

    public void setFinished(String finished) {
        this.finished = finished;
    }

    public String getEnd_place() {
        return end_place;
    }

    public void setEnd_place(String end_place) {
        this.end_place = end_place;
    }

    public String getStart_place() {
        return start_place;
    }

    public void setStart_place(String start_place) {
        this.start_place = start_place;
    }

    public String getCost() {
        return cost;
    }

    public void setCost(String cost) {
        this.cost = cost;
    }

    public Order parsing(JSONObject jsonObject){
        Order order=new Order();

        try {

            order.setCar_id(jsonObject.getString("car_code"));
            order.setCost(jsonObject.getString("cost"));
            order.setEnd_place(jsonObject.getString("end_place"));
            order.setFinished(jsonObject.getString("finished"));
            order.setId(jsonObject.getString("driver_name"));
            order.setPassenger(jsonObject.getString("passenger_name"));
            order.setStart_place(jsonObject.getString("start_place"));
            order.setType(jsonObject.getString("type"));
            order.setCar_type(jsonObject.getString("car_type"));

        } catch (JSONException e) {

            e.printStackTrace();
        }
        return order;
    }
}
